package com.zxmr.utility;

import java.io.IOException;

import com.zxmr.asyn.TaskMonitor;
import com.zxmr.db.DBManager;
import com.zxmr.utility.audit.TaskStateAuditManager;

public class ComponentInit {

	static DBManager db;
	static TaskMonitor auditMonitor;
	
	public static void initCommonSqlMapper(String config)
	{
		db = new DBManager();
		try {
			db.init(config);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public static DBManager getDBManager()
	{
		return db;
	}
	
	public static void initAudit()
	{
		auditMonitor = new TaskMonitor(1,1);
		Thread auditMonitorThread = new Thread(auditMonitor);
		auditMonitorThread.setName("auditMonitorThread");
		
		auditMonitorThread.start();
		
		TaskStateAuditManager.init(auditMonitor);
		
	}
}
